package com.general.framework.core.enums;

import com.general.framework.core.lang.Strings;

import java.util.Objects;

/**
 * Log操作类型
 * @author leejean
 */
public enum BusinessType {

    DEFAULT(0, "未知"),
    INSERT(1, "新增"),
    DELETE(2, "删除"),
    UPDATE(3, "修改"),
    SELECT(4, "查询"),
    EXPORT(5, "导出"),
    IMPORT(6, "导入"),
    GRANT( 7, "授权"),
    PAYMENT(8, "交易"),
    NOTIFY(9, "支付通知"),
    VIEW(10,   "查看");

    private int type;

    private String name;

    public int getType() {
        return type;
    }

    public void setType(int type) {
        this.type = type;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    BusinessType(int type, String name) {
        this.type = type;
        this.name = name;
    }

    public static String getDesc(Integer type) {
        for (BusinessType thisEnum : BusinessType.values()) {
            if (Objects.equals(thisEnum.type, type)) {
                return thisEnum.name;
            }
        }
        return Strings.EMPTY;
    }
}
